package com.atguigu.dga.governance.assessor.spec;

import com.atguigu.dga.governance.assessor.Assessor;
import com.atguigu.dga.governance.bean.AssessParam;
import com.atguigu.dga.governance.bean.GovernanceAssessDetail;
import com.atguigu.dga.meta.bean.TableMetaInfoExtra;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;

@Component("BUSI_OWNER")
public class BusiOwnerAssessor extends Assessor {
    @Override
    protected void assessProblem(GovernanceAssessDetail governanceAssessDetail, AssessParam assessParam) {
        TableMetaInfoExtra tableMetaInfoExtra = assessParam.getTableMetaInfo().getTableMetaInfoExtra();
        if(tableMetaInfoExtra.getBusiOwnerUserName()==null||tableMetaInfoExtra.getBusiOwnerUserName().trim().length()==0){
            governanceAssessDetail.setAssessScore(BigDecimal.ZERO);
            governanceAssessDetail.setAssessProblem("未填写业务Owner");

            String governanceUrl = assessParam.getGovernanceMetric().getGovernanceUrl();
            Long id = assessParam.getTableMetaInfo().getId();
            governanceUrl=governanceUrl.replace("{tableId}",id+"");
            governanceAssessDetail.setGovernanceUrl(governanceUrl);
        }
    }


    //

}
